﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CPPEI.Net
{
    /// <summary>
    /// 房间信息
    /// </summary>
    public class NetRoomData
    {
        /// <summary>
        /// 无效的房间id
        /// </summary>
        public const uint NULLROOMID = 99999;

        public uint ID { get; set; }

        public NetClientProxy[] ClientList { get; set; }

        public NetRoomData()
        {
            ClientList = new NetClientProxy[100];

        }

        public void AddClient(NetClientProxy clientProxy)
        {
            for (uint index = 0; index < ClientList.Length; index++)
            {
                if (ClientList[index] == null)
                {
                    ClientList[index] = clientProxy;
                    clientProxy.RoomID = this.ID;
                    return;
                }
            }
        }

        public void RemoveClient(NetClientProxy clientProxy)
        {
        }

        public NetClientProxy GetClient(uint clientID)
        {
            return null;
        }

        /// <summary>
        /// 删除所有的客户端信息
        /// </summary>
        public void RemoveAllClient()
        {
            for (uint index = 0; index < ClientList.Length; index++)
            {
                if (ClientList[index] != null)
                {
                    ClientList[index].RoomID = NetRoomData.NULLROOMID;

                    ClientList[index] = null;
                }
            }
        }
    }
}
